const eventNames = ['API:UN_AUTH', 'API:INVALID'] as const;
type EventName = (typeof eventNames)[number]

class EventEmitter {
  private listeners: Record<EventName, Set<Function>> = {
    'API:UN_AUTH': new Set,
    'API:INVALID': new Set,
  }

  on(eventName: EventName, listeners: Function) {
    this.listeners[eventName].add(listeners)
  }

  emit(eventName: EventName, ...args: any[]) {
    this.listeners[eventName].forEach((listener) => listener(...args))
  }
  // 优先级/ 取消等功能...
}

// 创建一个简单的事件中心
export default new EventEmitter();